package com.junyi.netty.time.client2;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ReplayingDecoder;

import java.util.List;

/**
 * TimeDecoder的升级版
 * 更简单的做法，使用 ReplayingDecoder
 * @time: 2022/3/25 14:28
 * @version: 1.0
 * @author: junyi Xu
 * @description:
 */
public class TimeDecoder2 extends ReplayingDecoder<Void>{
    @Override
    protected void decode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, List<Object> list) throws Exception {
        list.add(byteBuf.readBytes(4));
    }
}
